import { GCellRenderer } from "../../../../../../com/mui/controls/GCellRenderer";
import { ObjCreate } from "../../../common/ObjCreate";
import { ImagesConst } from "../../../../resource/ImagesConst";
import { GTextFormat } from "../../../../../common/GTextFormat";
import { FontUtil } from "../../../../../common/font/FontUtil";
import { SArenaCrossMyBetInfo } from "../../../../../../Message/Public/SArenaCrossMyBetInfo";
import { Language } from "../../../../../../extend/language/Language";
import { EBattleResult } from "../../../../../../Message/Public/EBattleResult";
import { GlobalStyle } from "../../../../../common/global/GlobalStyle";
import { EPrictUnit } from "../../../../../../Message/Public/EPrictUnit";
//class ArenaCrossFinalMyBetRankCellRenderer
    
    export  class ArenaCrossFinalMyBetRankCellRenderer extends GCellRenderer
    {
        constructor()
        {
            super();
            this.initView();
            return;
        }

        /* internal  */initView(): void
        {
            ObjCreate.createBg(4, 2, 443, 2, this, ImagesConst.SplitLine);
            this._matchIndexTx = ObjCreate.createTextField("", 6, 11, 85, 20, this, new GTextFormat(FontUtil.songtiName, 12, 65535, null, null, null, null, null, flash.text.TextFormatAlign.CENTER));
            this._betPlayerTx = ObjCreate.createTextField("", 96, 11, 98, 20, this, new GTextFormat(FontUtil.songtiName, 12, 65535, null, null, null, null, null, flash.text.TextFormatAlign.CENTER));
            this._betMoneyTx = ObjCreate.createTextField("", 215, 11, 66, 20, this, new GTextFormat(FontUtil.songtiName, 12, 65535, null, null, null, null, null, flash.text.TextFormatAlign.CENTER));
            this._resultTx = ObjCreate.createTextField("", 313, 11, 34, 20, this);
            this._rewardTx = ObjCreate.createTextField("", 372, 11, 80, 20, this, new GTextFormat(FontUtil.songtiName, 12, 65535, null, null, null, null, null, flash.text.TextFormatAlign.CENTER));
            return;
        }

        public /* override */ set data(arg1: Object)
        {
            var loc1=0;
            var loc2=null;
            super.data = arg1;
            this._info = arg1 as SArenaCrossMyBetInfo;
            if (this._info) 
            {
                loc1 = this._info.ring;
                if (loc1 == 1 || loc1 == 2 || loc1 == 3) 
                {
                    if (loc1 != 1) 
                    {
                        if (loc1 != 2) 
                        {
                            if (loc1 == 3) 
                            {
                                this._matchIndexTx.text = Language.getStringByParam(44333, 4);
                            }
                        }
                        else 
                        {
                            this._matchIndexTx.text = Language.getStringByParam(44333, 8);
                        }
                    }
                    else 
                    {
                        this._matchIndexTx.text = Language.getStringByParam(44333, 16);
                    }
                }
                else if (loc1 != 4) 
                {
                    this._matchIndexTx.text = Language.getString(44335);
                }
                else 
                {
                    this._matchIndexTx.text = Language.getString(44334);
                }
                this._betPlayerTx.text = this._info.toName;
                loc2 = this._info.result;
                if (loc2.value() != EBattleResult._EBattleResultLose) 
                {
                    if (loc2.value() != EBattleResult._EBattleResultWin) 
                    {
                        if (loc2.value() == EBattleResult._EBattleResultDraw || loc2.value() == EBattleResult._EBattleResultNULL) 
                        {
                            this._resultTx.text = " - -";
                            this._resultTx.setTextFormat(GlobalStyle.textFormatGreen);
                        }
                    }
                    else 
                    {
                        this._resultTx.text = Language.getString(44332);
                        this._resultTx.setTextFormat(GlobalStyle.textFormatGreen);
                    }
                }
                else 
                {
                    this._resultTx.text = Language.getString(44331);
                    this._resultTx.setTextFormat(new GTextFormat(FontUtil.songtiName, 12, 16711680));
                }
                if (this._info.betUnit != EPrictUnit._EPriceUnitCoin) 
                {
                    this._rewardTx.text = this._info.betReward.toString();
                    this._betMoneyTx.text = this._info.betNum.toString();
                }
                else 
                {
                    this._rewardTx.text = this._info.betReward.toString() + Language.getString(44310);
                    this._betMoneyTx.text = this._info.betNum.toString() + Language.getString(44310);
                }
            }
            else 
            {
                this._matchIndexTx.text = "";
                this._betPlayerTx.text = "";
                this._betMoneyTx.text = "";
                this._resultTx.text = "";
                this._rewardTx.text = "";
            }
            return;
        }

        /* internal */ /* var */_matchIndexTx: Object /* flash.text.TextField */;

        /* internal */ /* var */_betPlayerTx: Object /* flash.text.TextField */;

        /* internal */ /* var */_betMoneyTx: Object /* flash.text.TextField */;

        /* internal */ /* var */_resultTx: Object /* flash.text.TextField */;

        /* internal */ /* var */_rewardTx: Object /* flash.text.TextField */;

        /* internal */ /* var */_info: SArenaCrossMyBetInfo;
    }
